import Taro, {Component} from '@tarojs/taro'
import {View, Swiper, SwiperItem, Image} from '@tarojs/components'
import './index.scss'


export default class SwiperBanner extends Component {

    static defaultProps = {
        list: []
    };

    render() {
        const {list} = this.props
        return (
            <View className={'home-banner'}>
                <Swiper
                    className='home-banner_swiper'
                    circular
                    indicatorDots
                    indicatorActiveColor='rgb(178, 42, 49)'
                    // TODO 目前 H5、RN 暂不支持 previousMargin、nextMargin
                    // previousMargin
                    // nextMargin
                    autoplay={true}>
                    {list.map(item => (
                        <SwiperItem
                            key={item.seq}
                            className={"home-banner_swiper-item"}
                        >
                            <Image
                                className={"home-banner_swiper-item-img"}
                                src={item.imgUrl}/>
                        </SwiperItem>
                    ))}
                </Swiper>
            </View>
        )
    }
}